var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = (function () {
    function t(t) {
        (this.all_Event = []), (this._value = t);
    }
    return (
        (t.Create = function (t, e) {
            if (this.datas[t]) throw Error("[EventData]这个全局名称已经被占用");
            return (this.datas[t] = e), e;
        }),
        Object.defineProperty(t.prototype, "value", {
            get: function () {
                return this._value;
            },
            set: function (t) {
                if (t != this._value) {
                    this._value;
                    (this._value = t), this.event(t);
                }
            },
            enumerable: !1,
            configurable: !0
        }),
        (t.prototype.on = function (t, e, o) {
            void 0 === o && (o = !1), this.all_Event.push({the: t, fun: e}), o && e.call(t, this._value);
        }),
        (t.prototype.off = function (t, e) {
            for (var o = 0; o < this.all_Event.length; o++) {
                var n = this.all_Event[o];
                if (n.the == t && n.fun == e) return void this.all_Event.splice(o, 1);
            }
            throw Error("无对应的对象");
        }),
        (t.prototype.event = function (t) {
            for (var e = this.all_Event, o = 0; o < e.length; o++) {
                var n = e[o];
                n.fun.call(n.the, t);
            }
        }),
        (t.prototype.emit = function () {
            this.event(this._value);
        }),
        (t.datas = {}),
        t
    );
})();
o.default = n;
